import { ajax } from '@/utils'

const baseUrl = '/system/dept'

export default {
  getDeptList(...args: IGetDeptListReq): Promise<IGetDeptListRes> {
    return ajax.post(`${baseUrl}/list`, args[0])
  },
  getDeptTree(): Promise<IGetDeptTreeRes> {
    return ajax.get(`${baseUrl}/tree`)
  },
  createDept(...args: ICreateDeptReq): IVoidRes {
    return ajax.post(`${baseUrl}/create`, args[0])
  },
  updateDept(...args: IUpdateDeptReq): IVoidRes {
    return ajax.put(`${baseUrl}/update/${args[0]}`, args[1])
  },
  deleteDept(...args: IDeleteReq): IVoidRes {
    return ajax.delete(`${baseUrl}/delete`, { data: args[0] })
  }
}
